<table>
    <tbody>
        <tr>
            <td width="120"><?php echo $form->label('CustProductSite.stock_code'); ?></td>
            <td><?php echo $form->text('CustProductSite.stock_code'); ?></td>
            <td width="150px"><?php echo $form->label('Product.category_id', 'Category'); ?></td>
            <td><?php echo $form->select('Product.category_id', $categories, null, array('class' => 'wide')); ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('Product.part_no', 'Vendor Part no.'); ?></td>
            <td><?php echo $form->text('Product.part_no'); ?></td>
            <td><?php echo $form->label('Product.model'); ?></td>
            <td><?php echo $form->text('Product.model'); ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('Product.title'); ?></td>
            <td colspan="3"><?php echo $form->text('Product.title', array('class' => 'wide')); ?></td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('Product.text', 'Description'); ?></td>
            <td colspan="3"><?php echo $form->textarea('Product.text', array('class' => 'wide')); ?></td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('CustProductSite.current_stock', 'Current Stock'); ?></td>
            <td colspan="3">
                <?php echo $form->select('Operand.current_stock', $operands, '>'); ?>
                <?php echo $form->text('CustProductSite.current_stock', array('size' => 5, 'class' => 'text-right')); ?>
            </td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('CustProductSite.reserve_qty', 'Reserve Qty.'); ?></td>
            <td colspan="3">
                <?php echo $form->select('Operand.reserve_qty', $operands, '>'); ?>
                <?php echo $form->text('CustProductSite.reserve_qty', array('size' => 5, 'class' => 'text-right')); ?>
            </td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('CustProductSite.min_stock', 'Min Stock'); ?></td>
            <td>
                <?php echo $form->select('Operand.min_stock', $operands, '>'); ?>
                <?php echo $form->text('CustProductSite.min_stock', array('size' => 5, 'class' => 'text-right')); ?>
            </td>
            <td class="top"><?php echo $form->label('CustProductSite.last_stock_in_date', 'Last Stock in Date'); ?></td>
            <td>
                From <?php echo $form->text('CustProductSite.last_stock_in_date_start', array('size' => 7, 'class' => 'text-right')); ?>
                To <?php echo $form->text('CustProductSite.last_stock_in_date_end', array('size' => 7, 'class' => 'text-right')); ?>
            </td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('CustProductSite.max_stock', 'Max Stock'); ?></td>
            <td>
                <?php echo $form->select('Operand.max_stock', $operands, '>'); ?>
                <?php echo $form->text('CustProductSite.max_stock', array('size' => 5, 'class' => 'text-right')); ?>
            </td>
            <td class="top"><?php echo $form->label('CustProductSite.last_stock_out_date', 'Last Stock out Date'); ?></td>
            <td>
                From <?php echo $form->text('CustProductSite.last_stock_out_date_start', array('size' => 7, 'class' => 'text-right')); ?>
                To <?php echo $form->text('CustProductSite.last_stock_out_date_end', array('size' => 7, 'class' => 'text-right')); ?>
            </td>
        </tr>
        <?php if ($session->read('Auth.User.Extend.from_supplier') != true) : ?>
                    <tr>
                        <td class="top"><?php echo $form->label('CustProductSite.dispatch_from', 'Dispatch From'); ?></td>
                        <td colspan="3">
                <?php echo $form->radio('CustProductSite.dispatch_from', array(ITS_PREFIX => 'ITS', SUPPLIER_PREFIX => 'Other Vendor', '' => 'All'), array('legend' => false)); ?>
                <?php echo $form->select('CustProductSite.supplier_id', $suppliers, null, array('style' => 'display: none;')); ?>
                </td>    
            </tr>
            <tr>
                <td><?php echo $form->label('Product.brand_id', 'Brand'); ?></td>
                <td colspan="3"><?php echo $form->select('Product.brand_id'); ?></td>
            </tr>
        <?php endif; ?>
                </tbody>
            </table>

            <div class="hide">
    <?php echo $form->select('its_brand_id', $itsBrands, null, array('disabled' => true), OPTION_ALL); ?>
    <?php echo $form->select('supplier_brand_id', $supplierBrands, null, array('disabled' => true), OPTION_ALL); ?>
    <?php echo $form->select('all_brand_id', $allBrands, null, array('disabled' => true), OPTION_ALL); ?>
</div>

<script type="text/javascript">
    $j(function() {
        $j.datesearchpicker("#CustProductSiteLastStockInDate");
        $j.datesearchpicker("#CustProductSiteLastStockOutDate");
        $j(':radio').bind('click', function() {
            var dispatch_from = $j(this).val();
            if (dispatch_from == SUPPLIER_PREFIX) {
                $j('#CustProductSiteSupplierId').show();
                $j('#ProductBrandId').html($j('#supplier_brand_id').html());
            } else if (dispatch_from == ITS_PREFIX) {
                $j('#CustProductSiteSupplierId').hide().val('');
                $j('#ProductBrandId').html($j('#its_brand_id').html());
            } else {
                $j('#CustProductSiteSupplierId').hide().val('');
                $j('#ProductBrandId').html($j('#all_brand_id').html());
            }
        });

        $j('#CustProductSiteSupplierId').bind('change', function() {
            $j('#ProductBrandId').requestOptions('cust_product_sites/option_vendor_brand_list', $j(this).val(), {empty_option: '--All--'});
        });

        $j(':radio[id=CustProductSiteDispatchFrom]').click();
    })
</script>